package com.ansion.baseui.base;

import android.app.Activity;
import android.view.View;

import androidx.annotation.IdRes;
import androidx.annotation.Nullable;

import com.ansion.baseui.base.loading.CustomAlertDialog;


/**
 * created by zhaoyuntao
 * on 22/02/2022
 * description:
 */
public abstract class TVPFragmentUIProxy<F extends TVPBaseFragment<?>, P extends TBasePresenter<?>> extends TVPBaseUIProxy<F, P> implements ToastSupport, LoadingSupport {

    public TVPFragmentUIProxy(F f) {
        super(f);
    }

    public F fragment() {
        return getView();
    }

    @Override
    final public Activity activity() {
        return getView().activity();
    }

    @SuppressWarnings("TypeParameterUnusedInFormals")
    final public <T extends View> T findViewById(@IdRes int id) {
        return fragment().findViewById(id);
    }

    @Override
    final public CustomAlertDialog getLoadingDialog() {
        return fragment().getLoadingDialog();
    }

    @Override
    final public void onSetLoadingDialog(@Nullable CustomAlertDialog loadingDialog) {
        fragment().onSetLoadingDialog(loadingDialog);
    }

    protected void registerOnClickListener(@IdRes int resId) {
        fragment().registerOnClickListener(resId);
    }

    protected void onStartFragment() {

    }

    protected void onResumeFragment() {

    }

    protected void onPauseFragment() {

    }

    protected void onStopFragment() {

    }

    protected void onDestroyFragment() {

    }

    protected void onDetachFromActivity() {

    }
}
